<template>
  <div>
    <el-button @click="test"> from取值</el-button>
    <el-form :inline="true" :model="searchFrom">
      <el-form-item label="账户">
        <child-solt tree lab="name" val="code" :options="data" v-model:value="searchFrom.personName" />
      </el-form-item>
      <el-form-item label="性别">
        <child-solt select multiple lab="name" val="code" :options="list" v-model:value="searchFrom.sex" @change="change" />
      </el-form-item>
      <el-form-item label="搜索">
        <el-input v-model="searchFrom.search" placeholder="书名或作者"></el-input>
      </el-form-item>
      <el-form-item label="下拉图标"> <yu-select icon v-model:value="searchFrom.icon" /></el-form-item>
      <el-form-item label="下拉树状菜单"> <yu-select dictCode="sysMenuTree" tree v-model:value="searchFrom.menu" /></el-form-item>
    </el-form>
  </div>
</template>

<script setup>
  import ChildSolt from './ChildSolt.vue';
  import { ref } from 'vue';
  import YuSelect from '@/components/com/YuSelect.vue';

  const test = () => {
    console.log(searchFrom.value);
    alert(JSON.stringify(searchFrom.value));
  };
  const searchFrom = ref({});
  const list = ref([
    {
      code: '选项1',
      name: '黄金糕',
      disabled: false,
    },
    {
      code: '选项2',
      name: '双皮奶',
      disabled: false,
    },
    {
      code: '选项23',
      name: '双皮奶1',
      disabled: false,
    },
    {
      code: '选项24',
      name: '双皮奶2',
      disabled: false,
    },
  ]);
  let personName = ref('asd');

  const data = [
    {
      code: '1',
      name: 'Level one 1',
      children: [
        {
          code: '1-1',
          name: 'Level two 1-1',
          children: [
            {
              code: '1-1-1',
              name: 'Level three 1-1-1',
            },
          ],
        },
      ],
    },
    {
      code: '2',
      name: 'Level one 2',
      children: [
        {
          code: '2-1',
          name: 'Level two 2-1',
          children: [
            {
              code: '2-1-1',
              name: 'Level three 2-1-1',
            },
          ],
        },
        {
          code: '2-2',
          name: 'Level two 2-2',
          children: [
            {
              code: '2-2-1',
              name: 'Level three 2-2-1',
            },
          ],
        },
      ],
    },
    {
      code: '3',
      name: 'Level one 3',
      children: [
        {
          code: '3-1',
          name: 'Level two 3-1',
          children: [
            {
              code: '3-1-1',
              name: 'Level three 3-1-1',
            },
          ],
        },
        {
          code: '3-2',
          name: 'Level two 3-2',
          children: [
            {
              code: '3-2-1',
              name: 'Level three 3-2-1',
            },
          ],
        },
      ],
    },
  ];

  const change = value => {};
</script>

<style lang="scss" scoped></style>
